import 'package:flutter/material.dart';
import 'package:flutter_cate/core/extension/int_extension.dart';
import 'package:flutter_cate/ui/pages/filter/filter.dart';

class AMHomeDrawer extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 250.px,
      child: Drawer(
        child: Column(
          children: <Widget>[
            buildHeaderView(context),
            buildListTitle(context, Icon(Icons.restaurant), "进餐", () {
              Navigator.of(context).pop();
            }),
            buildListTitle(context, Icon(Icons.settings_applications), "筛选", () {
              Navigator.of(context).pop();
              Navigator.of(context).pushNamed(AMFilterScreen.routeName);
            }),
          ],
        ),
      ),
    );
  }

  Widget buildHeaderView (BuildContext context) {
    return Container(
      width: double.infinity,
      height: 120.px,
      color: Colors.orange,
      margin: EdgeInsets.only(bottom: 20.px),
      alignment: Alignment(0,0.5),
      child: Text("开始动手", style: Theme.of(context).textTheme.headline3,),
    );
  }

  Widget buildListTitle(BuildContext context, Widget icon, String title, Function handle) {
    return ListTile(
      leading: icon,
      title: Text(title, style: Theme.of(context).textTheme.headline2,),
      onTap: handle,
    );
  }
}
